Cooperation between FlashAir IoT Hub and IFTTT(Action)

Latest update: November 2018

Overview

This tutorial will explain the IFTTT linkage function used by the FlashAir IoT Hub.
For basic usage of IFTTT and IFTTT linkage, please see Trigger version.


FlashAir settings

Please prepare to be able to connect your FlashAir to the FlashAir IoT Hub in advance referencing the flow of usage steps.

To enable FlashAir's GPIO function, edit /SD_WLAN/CONFIG in FlashAir and add IFMODE=1.

It is always a good idea to read through the tutorial after confirming that FlashAir is online.

GPIO output

Let's try to get our LED to flicker with IFTTT linkage using the GPIO function of FlashAir IoT Hub.

To use FlashAir's GPIO function, use Airio RP which is a prototyping board of FlashAir.

For Airio RP, refer to FlashAir prototyping board "Airio RP".

For details of GPIO function, please refer to here.

Make a Webhook

Configure Webhook on FlashAir IoT Hub.

Let's click "Set WebHook" at action of FlashAir IoT Hub > GPIO output.

Click "Enable".

Please note the value of the key displayed on the page. It is used for making the Webhook.

Make an Applet

Next, let's make an Applet that displays graphs on FlashAir IoT Hub on the IFTTT My Applets page.

My Appletsページ

Click "New Applet" and click "this" part.

thisを選択

Search "Webhooks" and click the icon.

Webhooksを選択

Click "Receive a web request".

triggerを選択

Enter Event Name to identify Webhook and click "Create trigger".

triggerを作成

Then click "that" part.

thatを選択

Search "Webhooks" and click the icon.

Emailを選択

Enter the value created here in the displayed dialog and click "Create action".

action選択
  • URL
    Please copy and paste the value in the frame and input.
  • Method
    POST
  • ContentType
    application/json
  • Body
    Please copy and paste the value in the frame and input.

When you click "Finish", IFTTT setting is completed.

Appletの確認画面
Applet設定完了

Launch FlashAir

Insert FlashAir into Airio RP, insert Micro USB cable connected to a power supply and start up.

After starting up and after confirming that the LED of the Airio RP turns off, it is ready.

実機の写真

IFTTT cooperate

Let's display the graph on the FlashAir IoT Hub from the created Applet.

Log in to IFTTT, open the Webhooks page and click "Documentation".

Webhooks

In {event}, enter the Event Name (example: flashair) entered when creating the Applet and click "Test It".

Execution result

Now that we are ready, let's run it.

I think whether you can confirm that the LED of Airio RP turns on by pressing "Test It".

LED flicker

If you change the "data": in the Body part from 2 to 1 and then execute Applet again, the LED goes out.

Script execution

Next, let's call the Lua script in FlashAir from IFTTT and execute it. FlashAir Set with IoT Hub and IFTTT.

Make a Webhook

Configure Webhook on FlashAir IoT Hub.

FlashAir IoT Hub action > Click "Set WebHook" at the script execution place.

If the Webhook setting has already been activated, the content to be entered in the action field is displayed with it entered. If you have not enabled Webhook settings, please click "Enable".
Write down the value displayed on the page. It is used for making Webhook.

Make an Applet

I will create an Applet just like here.

Please enter the value created above in Complete action fields.

/echo.lua in the body is a script that displays measured values. For details, please click here.

Execution result

Let's check whether the measured value is actually transmitted.

Let's call the created Applet like this.

Script execution tasks are displayed on jobs waiting to be processed. If the status does not change and remains unchanged, please check that FlashAir is online. Let's display the trigger > measured value graph when the status has been executed.

A graph is displayed each time "Test It" is pressed.

By modifying the red part of Body according to your environment, it can be applied to various forms.

Summary

With FlashAir IoT Hub and IFTTT, IFTTT was able to call data on FlashAir in cooperation with Web services.
This time I updated the FlashAir IoT Hub from the outside using IFTTT, but it is possible to collaborate if it is a Web service that can set a Webhook.

Operate the lua script in the FlashAir from the outside, display the graph of the measured value, when rain falls, the Airio RP LED will flicker and announce it to you! Now you're free to think up various other methods of using this type of functionality.